<?xml version="1.0" ?>
<WorkflowLog xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://is.tm.tue.nl/research/processmining/WorkflowLog.xsd">
  <% 
  
  csv = PNEngine::CsvLogger.get_csv  
  processes = csv.collect { |line|  line[7]}.uniq
  
%>
  
  <% processes.each do |cur_process| %>
    <Process id="<%= cur_process %>">
      <% cases = csv.select { |line| line[7] == cur_process && (line[0] == 'manual_fire' or line[0] == 'automatic_fire')} .collect { |item| item[6] }.uniq %>
    
      <% cases.each do |cur_case| %>  
        <ProcessInstance id="<%= cur_case %>">
          <% entries = csv.select{ |line| line[7] == cur_process && (line[0] == 'manual_fire' or line[0] == 'automatic_fire') && line[6] == cur_case} %>
          <% entries.each do |entry| %>
            <AuditTrailEntry>
              <WorkflowModelElement><%= entry[4] %></WorkflowModelElement>
              <EventType><%= entry[5]  %></EventType>
              <Timestamp><%= entry[1] %></Timestamp>
              <Originator><%= entry[2] %></Originator>
            </AuditTrailEntry>
          <%  end %>
        </ProcessInstance>
      <% end %>
    </Process>
  <% end %>
</WorkflowLog>